﻿Public Class xtf_LISTADOrecibo_

    Public Overrides Sub IniciarLista()
        Try
            gdc_general.BeginUpdate()
            gdc_general.DataSource = dtt_DataTable
            'ulg_Lista.DisplayLayout.GroupByBox.Style = Infragistics.Win.UltraWinGrid.GroupByBoxStyle.Full

            'Creacion y carga de Cuentas
            dtt_DataTable.Columns.Add("Identificador (ID)")
            dtt_DataTable.Columns.Add("Fecha", GetType(Date))
            dtt_DataTable.Columns.Add("Talonario")
            dtt_DataTable.Columns.Add("Numero")
            dtt_DataTable.Columns.Add("Cliente")
            dtt_DataTable.Columns.Add("Importe")

            gdv_general.PopulateColumns(dtt_DataTable)

            Dim obj_recibo_ As New cls_recibo_
            If obj_recibo_.CargarTodos(ObtenerRegistroEstado) Then
                For Each recibo As cls_recibo_ In obj_recibo_.Items
                    AgregarItem(recibo)
                Next
            End If
            'ulg_Lista.DataBind()

            FiltrarColumnas()
            gdc_general.EndUpdate()
        Catch ex As Exception
            'Dim frmError As New frm_ErrorManager(ex.Message)
        End Try
    End Sub

    Public Function AgregarItem(ByRef recibo As cls_recibo_) As DataRow
        Dim Row As DataRow = dtt_DataTable.NewRow
        Row("Identificador (ID)") = recibo.idrecibo
        Row("Fecha") = recibo.fecha
        Row("Talonario") = recibo.idtalonario
        Row("Numero") = recibo.numero
        Row("Cliente") = recibo.idtercero
        Row("Importe") = recibo.importe

        dtt_DataTable.Rows.Add(Row)
        'ulg_Lista.Rows(ulg_Lista.Rows.Count - 1).Height = 19
        Return Row
    End Function

    Public Sub ModificarItem(ByRef recibo As cls_recibo_, ByRef ulg_row As DataRow)
        ulg_row("Identificador (ID)") = recibo.idrecibo
        ulg_row("Fecha") = recibo.fecha
        ulg_row("Talonario") = recibo.idtalonario
        ulg_row("Numero") = recibo.numero
        ulg_row("Cliente") = recibo.idtercero
        ulg_row("Importe") = recibo.importe
    End Sub

    Public Sub New()

        Me.Cursor = Cursors.WaitCursor
        InitializeComponent()
        PERMISONuevo = "004013002"
        PERMISOModificar = "004013003"
        PERMISOEliminar = "004013004"
        PERMISOImprimir = "004013005"
        Me.Text = lbl_modulo.Text : lbl_modulodescripcion.Text = "Listado de " & lbl_modulo.Text & "."
        IniciarLista()
        Me.Cursor = Cursors.Default

    End Sub

End Class
